package com.ncd.disease.result;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ncd.common.annotation.Excel;
import lombok.Data;

import java.util.Date;

/**
 * @author zhouxin
 * @version 1.0
 * Create by 2024-03-10 16:20
 */
@Data
public class RetAdmResult {

    private Long admId;

    private Long patId;

    /** 患者姓名 */
    @Excel(name = "患者姓名")
    private String patName;

    /** 电话 */
    @Excel(name = "电话")
    private String patTel;

    /** 联系人 */
    @Excel(name = "联系人")
    private String patContact;

    /** 联系人电话 */
    @Excel(name = "联系人电话")
    private String patContactTel;

    /** 复诊日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "复诊日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date admDate;

    /** 复诊日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "当前日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date admCreateDate;
    /** 时间间隔 */
    private String timeInterval;

    /** 复诊状态 */
    @Excel(name = "复诊状态")
    private String admStatus;

    public String getTimeInterval() {
        if(ObjectUtil.isNotNull(admDate)&&ObjectUtil.isNotNull(admCreateDate)){
            return  DateUtil.between(admCreateDate, admDate, DateUnit.DAY)+"天";
        }
        return "";
    }
}
